home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / borland / jnfb88.zip / KEYINT.ZIP / ERROR.INC < prev    next >
Text File  |  1987-10-07  |  1KB  |  41 lines

  1. (*ERROR.INC
  2.   This is the error handler for ALL the INT9 front end
  3.   demo programs*)
  4. TYPE
  5.   string2 = string[2];
  6.   string4 = string[4];
  7.  
  8. CONST
  9.   HexDigit : ARRAY[0..15] OF Char = '0123456789ABCDEF';
  10.  
  11.   FUNCTION HexByte(B : Byte) : string2;
  12.   BEGIN
  13.     HexByte := HexDigit[B SHR 4]+HexDigit[B AND $F];
  14.   END;
  15.  
  16.   FUNCTION Hex(I : Word) : string4;
  17.   BEGIN
  18.     Hex := HexByte(Hi(I))+HexByte(Lo(I));
  19.   END;
  20.  
  21.  
  22. {$F+}  PROCEDURE My_Error; {$F-}
  23.   BEGIN
  24.     SetIntVec(Kbd_Int, Kbd_vec); {restore OLD INT9}
  25.     IF (ExitCode <> 0) OR (ErrorAddr <> NIL) THEN
  26.       BEGIN
  27.         Assign(Output,'');
  28.         ReWrite(OutPut);
  29.         WriteLn(#7);
  30.         IF ExitCode = $FF THEN
  31.           WriteLn('USER BREAK')
  32.         ELSE
  33.           BEGIN
  34.             WriteLn('Critical Error # ',HEX(ExitCode));
  35.             Write('AT PROGRAM LOCATION ');
  36.             WriteLn(HEX(seg(ErrorAddr^)),':',Hex(ofs(ErrorAddr^)));
  37.           END;
  38.       END;
  39.     ExitProc := Exit_Vec;        {restore previous ExitProc}
  40.   END;
  41.